#pragma once

value functionB(value x) {
	return 4 / (1 + x * x);
}

matrix functionN(matrix *x) {
	matrix y;
	InitialMatrix(0, &y, 2, 1);
	y.M[0] = (x->M[0] - 2)*x->M[0] - x->M[1] + 0.5;
	y.M[1] = pow(x->M[0], 2) + 4 * pow(x->M[1], 2) - 4;
	return y;
}
matrix functionJ(matrix *x) {
	matrix dy;
	InitialMatrix(0, &dy, 2, 2);
	dy.M[0] = 2 * x->M[0] - 2;
	dy.M[1] = -1;
	dy.M[2] = 2 * x->M[0];
	dy.M[3] = 8 * x->M[1];
	return dy;
}

matrix functionR(value x, matrix *Y) {
	matrix f;
	InitialMatrix(0, &f, 1, 2);
	f.M[0] = -0.01*Y->M[0] - 99.99*Y->M[1];
	f.M[1] = -100 * Y->M[1];
	return f;
}

value functionC(value x) {
	return x * x*x + x * x - 3 * x - 3;
}

value functionA(value x, value y) {
	return y - 2 * x / y;
}